<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4" >
<head>
    <meta charset="UTF-8">
    <title >投稿管理</title>
    <!--    导入layui组件，优秀的弹窗框架-->
    <link rel="stylesheet" th:href="@{/plugins/layui-v2.6.8/layui/css/layui.css}">

    <!--    导入layui组件，优秀的弹窗框架-->
    <script th:src="@{/plugins/layui-v2.6.8/layui/layui.js}"></script>
    <link rel="stylesheet" th:href="@{/css/font-img.css}">
</head>
<body>
<!--<button type="button" class="layui-btn layui-btn-primary" th:text="'找到'+${articles.size()}+'篇相关'">原始按钮</button>-->
<!--<div th:text="'找到'+${articles.size()}+'篇相关'"></div>-->

<div class="col-md-12">

    <table class="layui-table" lay-skin="line">
        <colgroup>
            <col width="150">
            <col width="150">
            <col width="200">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th>稿件名称</th>
            <th>用户</th>
            <th>时间</th>
            <th>投稿状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="list : ${userManuscripts}">
            <td >
                <div class="btn-group">
                    <a  href="javascript:;" target="_blank" th:text="${list.manuscriptName}" >

                    </a>
                </div>
            </td>

            <td th:text="${list.userName}"></td>

            <td th:text="${#dates.format(list.manuscriptCreateDate,'yyyy/MM/dd HH:mm:ss')}">1989-10-14</td>
            <td th:if="${list.manuscriptStatus}==0" >审核中</td>
            <td th:if="${list.manuscriptStatus}==1" >通过</td>
            <td th:if="${list.manuscriptStatus}==2" >未通过</td>
            <td>
                <div class="btn-group">
                    <a  th:href="@{'/manuscript/download/'+${list.id}+'/'+${list.manuscriptName}}" class="layui-btn layui-btn-normal layui-btn-sm"><i class="iconfont icon-xiazai1x" style="width: 24px;display: inline-block;font-weight: 100"></i></a>
                    <button type="button" th:onclick="'javascript:audit('+1+','+${list.id}+')'" class="layui-btn layui-btn-normal layui-btn-sm">通过</button>
                    <button type="button" th:onclick="'javascript:audit('+2+','+${list.id}+')'" class="layui-btn layui-btn-normal layui-btn-sm">拒绝</button>
                </div>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<script  type="text/javascript" th:src="@{/plugins/jquery-3.5.1.min.js}"></script>

<script type="text/javascript">
    function audit(status,id) {
        // alert("ok")
        $.ajax({
            url:"/admin/updateManuscriptStatus",
            // dataType:'json',
            data:{
               "status" : status,
                "id" :id
            },
            success:function (data) {
                location.reload();
            }
        });
    }
</script>
</body>
</html>